﻿namespace Trading.Studio

open System.Reactive.Linq 

[<AbstractClass>]
type Controller<'M, 'E>(model : 'M) =
    abstract HandleEvent : 'M * 'E -> unit
    member this.Activate(view : IView<'M, 'E>) = 
        view.Model <- model
        view.Events
            .ObserveOnDispatcher()
            .Add(fun e -> this.HandleEvent(model, e))

